﻿using Budget.Config;
using Budget.Data.Mappings;
using NHibernate.Cfg;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Dialect;
using NHibernate.Driver;

namespace Budget.Data.Configs
{
    public class SqlConfig : DBConfig<MsSql2008Dialect, Sql2008ClientDriver>
    {
        public SqlConfig(string connection) : base(connection)
        {
        }

        public override Configuration GetConfig()
        {
            config = base.GetConfig();

            var mapper = new DomainMapper();
            HbmMapping generateMappings = mapper.GenerateMappings();

            config.AddDeserializedMapping(generateMappings, string.Empty);

            return config;
        }
    }
}